<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>站内信编辑</title>
<#include "/WEB-INF/content/module-edit.html">
<link href="${request.contextPath}/res/kindeditor/themes/default/default.css" rel="stylesheet" />
<script charset="utf-8" src="${request.contextPath}/res/kindeditor/kindeditor.js"></script>
<script charset="utf-8" src="${request.contextPath}/res/kindeditor/lang/zh_CN.js"></script>
<script type="text/javascript">
var sysStatus = [
    {"id":"0","text":"未推送"},
    {"id":"1","text":"已推送"}
];
KindEditor.ready(function(K) {
    window.editor = K.create('#mas', {
        langType : 'zh_CN',
        height:"400px",
        uploadJson : '${request.contextPath}/res/kindeditor/jsp/upload_json_textarea.jsp',
        fileManagerJson : '${request.contextPath}/res/kindeditor/jsp/file_manager_json.jsp',
        allowFileManager :false,
        items:['source', '|', 'undo', 'redo', '|', 'preview', 'print', 'template', 'code', 'cut', 'copy', 'paste',
               'plainpaste', 'wordpaste', '|', 'justifyleft', 'justifycenter', 'justifyright',
               'justifyfull', 'insertorderedlist', 'insertunorderedlist', 'indent', 'outdent', 'subscript',
               'superscript', 'clearhtml', 'quickformat', 'selectall', '|', 'fullscreen', '/',
               'formatblock', 'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold',
               'italic', 'underline', 'strikethrough', 'lineheight', 'removeformat', '|', 'image', 'table', 'hr', 'baidumap', 'pagebreak',
               'anchor', 'link', 'unlink', '|', 'about'
       ],themeType : 'simple',
       });
});
$(function() {
  	$("#status").combobox({
  		valueField : 'id',
  		textField : 'text',
  		editable:false,
  		data:sysStatus
  	}); 
 });
 
 function mySave(){
	 var head="<!DOCTYPE html><html><head><meta charset=\"UTF-8\"><title></title><meta name=\"viewport\" content=\"width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no\" /><script type=\"text/javascript\">"+
	 "document.documentElement.style.fontSize = document.documentElement.clientWidth / 7.5 + 'px';"+
	 "<\/script><style type=\"text/css\">*{margin: 0;padding: 0;}img{width: 100%;padding-bottom: 0.4rem;}"+
	 "html{font-size: 0.24rem;font-family: sans-serif;line-height: 1.7rem;color: #787878;}@media screen and (max-width: 321px) {body {font-size:0.24rem;padding: 0.2rem;text-align: justify;}}@media screen and (min-width: 321px) and (max-width:400px) {body {font-size:0.28rem;padding: 0.2rem;text-align: justify;}}@media screen and (min-width: 400px) {body {font-size:0.30rem;padding: 0.2rem;text-align: justify;}}</style></head><body>";
	 var tail="</body></html>";
	 var value=$("#mas").val();
	 if(value.indexOf("<!DOCTYPE")==-1){
		 $("#mas").val(head+value+tail);
	 }	 
	 save();
 }
</script>
<style>
.input-width{
	width: 95%;
}
</style>
 
</head>
<body class="easyui-layout">
	<div region="north" id="toolbar" style="background-color: #eee; padding: 5px; overflow: hidden;" border="false">
		<#if object.mid?exists&&object.mid!="">
			<@auth code="message:message:update">
				<a href="javascript:void(0);" class="easyui-linkbutton" plain="true" iconCls="icon-add" style="border: 1px solid #ccc" onclick="javascript:mySave()">保存</a>
			</@auth>
		<#else>
			<@auth code="message:message:create">
				<a href="javascript:void(0);" class="easyui-linkbutton" plain="true" iconCls="icon-add" style="border: 1px solid #ccc" onclick="javascript:mySave()">保存</a>
			</@auth>
		</#if>
		<a href="javascript:void(0);" class="easyui-linkbutton" plain="true" iconCls="icon-edit" style="border: 1px solid #ccc" onclick="javascript:cancel()">关闭</a>
	</div>
	<div region="center">
		<div id="p" class="easyui-panel" style="background: #fafafa; padding: 10px" fit="true" toolbar="#toolbar">
			<form id="form" method="post">
				<input id="_id" name="mid" type="hidden" value="${(object.mid)!}">
				<table class="form" cellspacing="0" style="width: 100%">
					<tbody style="border: 1px solid #ccc">
						<tr>
							<td class="label">标题：</td>
							<td><input id="title" name="title" class="easyui-validatebox" required="true" style="width:90%;" value="${(object.title)!}"/></td>
							<td class="validate">*</td>	
						</tr>				
						<tr>
							<td class="label">内容：</td>
							<td><textarea id="mas" name="content" class="easyui-validatebox" required="true" style="width:90%;">${(object.content)!}</textarea></td>
							<td class="validate">*</td>	
						</tr>
						<tr>
							<td class="label">关联用户：</td>
							<td><input name="file" type="file"/>&nbsp;&nbsp;&nbsp;&nbsp;过期时间：<input id="overduetime" name="overduetime" class="easyui-datetimebox"/></td>
						</tr>
					</tbody>
				</table>
			</form>
		</div>
	</div>
</body>
</html>